import React, { Component } from 'react'
import axios from "axios"
export default class App extends Component {
    getData = () => {
        axios.get("http://localhost:3000/api1/students").then(
            (res) => {console.log(res.data)},
            (err) => {console.log(err)}
        )
    }
    getData2 = () => {
        axios.get("http://localhost:3000/api2/cars").then(
            (res) => {console.log(res.data)},
            (err) => {console.log(err)}
        )
    }
    render() {
        return (
            <div>
                <button onClick={this.getData}>点击我获取数据</button>
                <button onClick={this.getData2}>点击我获取数据</button>
            </div>
        )
    }
}
